package com.ruoyi.statisticalCenter.service.impl;

import java.util.List;

import com.github.pagehelper.PageHelper;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.statisticalCenter.domain.vo.ScCustomerBadDebtVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.statisticalCenter.mapper.ScCustomerBadDebtMapper;
import com.ruoyi.statisticalCenter.domain.ScCustomerBadDebt;
import com.ruoyi.statisticalCenter.service.IScCustomerBadDebtService;
import com.ruoyi.common.core.text.Convert;

/**
 * 客户账单核销Service业务层处理
 *
 * @author pyx
 * @date 2024-03-01
 */
@Service
public class ScCustomerBadDebtServiceImpl implements IScCustomerBadDebtService {
    @Autowired
    private ScCustomerBadDebtMapper scCustomerBadDebtMapper;

    /**
     * 查询客户账单核销
     *
     * @param id 客户账单核销主键
     * @return 客户账单核销
     */
    @Override
    public ScCustomerBadDebt selectScCustomerBadDebtById(Long id) {
        return scCustomerBadDebtMapper.selectScCustomerBadDebtById(id);
    }

    /**
     * 查询客户账单核销列表
     *
     * @param scCustomerBadDebtVo 客户账单核销
     * @return 客户账单核销
     */
    @Override
    public List<ScCustomerBadDebt> selectScCustomerBadDebtList(ScCustomerBadDebtVo scCustomerBadDebtVo) {
        //添加分页查询
        PageHelper.startPage(scCustomerBadDebtVo.getPageDate());
        return scCustomerBadDebtMapper.selectScCustomerBadDebtList(scCustomerBadDebtVo);
    }

    /**
     * 新增客户账单核销
     *
     * @param scCustomerBadDebt 客户账单核销
     * @return 结果
     */
    @Override
    public R insertScCustomerBadDebt(ScCustomerBadDebt scCustomerBadDebt) {
        return scCustomerBadDebtMapper.insertScCustomerBadDebt(scCustomerBadDebt) > 0 ? R.ok("新增成功") : R.fail("新增失败");
    }

    /**
     * 修改客户账单核销
     *
     * @param scCustomerBadDebt 客户账单核销
     * @return 结果
     */
    @Override
    public int updateScCustomerBadDebt(ScCustomerBadDebt scCustomerBadDebt) {
        return scCustomerBadDebtMapper.updateScCustomerBadDebt(scCustomerBadDebt);
    }

    /**
     * 批量删除客户账单核销
     *
     * @param ids 需要删除的客户账单核销主键
     * @return 结果
     */
    @Override
    public int deleteScCustomerBadDebtByIds(String ids) {
        return scCustomerBadDebtMapper.deleteScCustomerBadDebtByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除客户账单核销信息
     *
     * @param id 客户账单核销主键
     * @return 结果
     */
    @Override
    public int deleteScCustomerBadDebtById(Long id) {
        return scCustomerBadDebtMapper.deleteScCustomerBadDebtById(id);
    }

    @Override
    public List<ScCustomerBadDebt> collect(ScCustomerBadDebtVo vo) {
        PageHelper.startPage(vo.getPageDate());
        return scCustomerBadDebtMapper.collect(vo);
    }
}
